package beanstao.util.store.common;

import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.Set;

import beanstao.util.Dates;

import com.google.common.collect.Maps;

/**
 * 描述一个设备类型的设备状态。key值是设备编号，value值是设备状态
 * @author beanstao@google.com 
 * 
 */
public abstract class DeviceStatus implements Map<String, StatusType>
{
	Map<String, StatusType> _InnerMap = Maps.newHashMap();

	public DeviceStatus()
	{
		if (_CurrDateTime == null)
			_CurrDateTime = Dates.now();
	}

	@Override
	public String toString()
	{
		return _InnerMap.toString();
	}

	/**
	 * @return 本类型状态的时间
	 */
	public Date getCurrentTime()
	{
		return _CurrDateTime;
	}

	private Date _CurrDateTime = null;

	/**
	 * @return 返回设备名称
	 */
	public abstract String getName();

	@Override
	public void clear()
	{
		_InnerMap.clear();
	}

	@Override
	public boolean containsKey(Object key)
	{
		return _InnerMap.containsKey(key);
	}

	@Override
	public boolean containsValue(Object value)
	{
		return _InnerMap.containsValue(value);
	}

	@Override
	public Set<java.util.Map.Entry<String, StatusType>> entrySet()
	{
		return _InnerMap.entrySet();
	}

	@Override
	public StatusType get(Object key)
	{
		return _InnerMap.get(key);
	}

	@Override
	public boolean isEmpty()
	{
		return _InnerMap.isEmpty();
	}

	@Override
	public Set<String> keySet()
	{
		return _InnerMap.keySet();
	}

	@Override
	public StatusType put(String key, StatusType value)
	{
		return _InnerMap.put(key, value);
	}

	@Override
	public void putAll(Map<? extends String, ? extends StatusType> m)
	{
		_InnerMap.putAll(m);
	}

	@Override
	public StatusType remove(Object key)
	{
		return _InnerMap.remove(key);
	}

	@Override
	public int size()
	{
		return _InnerMap.size();
	}

	@Override
	public Collection<StatusType> values()
	{
		return _InnerMap.values();
	}
}
